package com.ruoyi.coupons.service.impl;

import java.util.ArrayList;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.shopping.domain.CouponsVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.coupons.mapper.CouponsMemberMapper;
import com.ruoyi.coupons.domain.CouponsMember;
import com.ruoyi.coupons.service.ICouponsMemberService;

/**
 * 优惠券领取Service业务层处理
 *
 * @author ruoyi
 * @date 2021-11-26
 */
@Service
public class CouponsMemberServiceImpl implements ICouponsMemberService
{
    @Autowired
    private CouponsMemberMapper couponsMemberMapper;

    /**
     * 查询优惠券领取
     *
     * @param id 优惠券领取主键
     * @return 优惠券领取
     */
    @Override
    public CouponsMember selectCouponsMemberById(Long id)
    {
        return couponsMemberMapper.selectCouponsMemberById(id);
    }

    /**
     * 查询优惠券领取列表
     *
     * @param couponsMember 优惠券领取
     * @return 优惠券领取
     */
    @Override
    public List<CouponsMember> selectCouponsMemberList(CouponsMember couponsMember)
    {
        return couponsMemberMapper.selectCouponsMemberList(couponsMember);
    }

    /**
     * 新增优惠券领取
     *
     * @param couponsMember 优惠券领取
     * @return 结果
     */
    @Override
    public int insertCouponsMember(CouponsMember couponsMember)
    {
        couponsMember.setCreateTime(DateUtils.getNowDate());
        return couponsMemberMapper.insertCouponsMember(couponsMember);
    }

    /**
     * 修改优惠券领取
     *
     * @param couponsMember 优惠券领取
     * @return 结果
     */
    @Override
    public int updateCouponsMember(CouponsMember couponsMember)
    {
        couponsMember.setUpdateTime(DateUtils.getNowDate());
        return couponsMemberMapper.updateCouponsMember(couponsMember);
    }

    /**
     * 批量删除优惠券领取
     *
     * @param ids 需要删除的优惠券领取主键
     * @return 结果
     */
    @Override
    public int deleteCouponsMemberByIds(Long[] ids)
    {
        return couponsMemberMapper.deleteCouponsMemberByIds(ids);
    }


    /**
     * 批量逻辑删除优惠券领取
     *
     * @param ids 需要删除的优惠券领取主键
     * @return 结果
     */
    @Override
    public int logicDeleteCouponsMember(Long[] ids,String delType,Long delUser)
    {
        return couponsMemberMapper.logicDeleteCouponsMember(ids,delType,delUser);
    }

    /**
     * 删除优惠券领取信息
     *
     * @param id 优惠券领取主键
     * @return 结果
     */
    @Override
    public int deleteCouponsMemberById(Long id)
    {
        return couponsMemberMapper.deleteCouponsMemberById(id);
    }

    @Override
    public List<CouponsMember> selectCoupons(Long memberId, String useState,String selectCoupons) {
        return couponsMemberMapper.selectCoupons(memberId,useState,selectCoupons);
    }

    @Override
    public void setOldUser(ArrayList<Long> couponsIds) {
        couponsMemberMapper.setOldUser(couponsIds);
    }

    @Override
    public List<CouponsMember> selectNeedOverdue() {
        return couponsMemberMapper.selectNeedOverdue();
    }

    @Override
    public List<CouponsVo> selectMineList(CouponsVo vo) {
        return couponsMemberMapper.selectMineList(vo);
    }
}
